﻿using EM.OA.BLL;
using EM.OA.DataModel.DBModel;
using EM.OA.WebCommon.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Web;
namespace EM.OA.Portal.Models
{
    public class CarApplyModels : BaseViewModel
    {
        /// <summary>
        /// 申请ID
        /// </summary>		
        [Display(Name = "申请ID")]
        public Guid? ApplyID { get; set; }
        /// <summary>
        /// 车辆ID
        /// </summary>		
        [Display(Name = "车辆ID")]
        public Guid? CarID { get; set; }

        public string CarNumber { get {
            if (CarID.HasValue)
                return new CarInfoBLL().GetEntity(CarID.Value).CarNumber;
            else
                return string.Empty;
        } }
        /// <summary>
        /// 用车人
        /// </summary>		
        [Display(Name = "用车人")]
        public Guid? UseCarPersonID { get; set; }

        public string ApplyUserName
        {
            get
            {
                if (!UseCarPersonID.HasValue)
                    return string.Empty;
                else if (UseCarPersonID == new Guid())
                    return "admin";
                else
                    return new UserBLL().GetEntity(UseCarPersonID).UserName;
            }
        }
        /// <summary>
        /// 用车部门
        /// </summary>		
        [Display(Name = "用车部门")]
        public Guid? UserCarDepartmentID { get; set; }
        /// <summary>
        /// 随车人数
        /// </summary>		
        [Display(Name = "随车人数")]
        public int? WithCarNumber { get; set; }
        /// <summary>
        /// 预定日期
        /// </summary>
        [Display(Name = "预定日期")]
        public DateTime? ApplyDate { get; set; }

        public string ApplyStartTime2 { get; set; }
        public string ApplyEndTime2 { get; set; }
        /// <summary>
        /// 预计出发时间
        /// </summary>		
        [Display(Name = "预计出发时间")]
        public DateTime? ApplyStartTime { get; set; }
        /// <summary>
        /// 预计返回时间
        /// </summary>		
        [Display(Name = "预计返回时间")]
        public DateTime? ApplyEndTime { get; set; }
        /// <summary>
        /// 目的地
        /// </summary>		
        [Display(Name = "目的地")]
        public string Destination { get; set; }
        /// <summary>
        /// 申请里程数
        /// </summary>		
        [Display(Name = "申请里程数")]
        public int? ApplyMileage { get; set; }
        /// <summary>
        /// 用车原因
        /// </summary>		
        [Display(Name = "用车原因")]
        public string UseCarReason { get; set; }
        /// <summary>
        /// 是否需要司机
        /// </summary>		
        [Display(Name = "是否需要司机")]
        public bool IsNeedDriver { get; set; }
        /// <summary>
        /// 司机
        /// </summary>		
        [Display(Name = "司机")]
        public Guid? Driver { get; set; }
        /// <summary>
        /// 审批人
        /// </summary>		
        [Display(Name = "审批人")]
        public Guid? ApprovalUserID { get; set; }
        /// <summary>
        /// 审批备注
        /// </summary>		
        [Display(Name = "审批备注")]
        public string ApprovalRemark { get; set; }
        /// <summary>
        /// 审批时间
        /// </summary>		
        [Display(Name = "审批时间")]
        public DateTime? ApprovalTime { get; set; }
        /// <summary>
        /// 是否短消息提醒
        /// </summary>		
        [Display(Name = "是否短消息提醒")]
        public bool IsWebMessage { get; set; }
        /// <summary>
        /// 是否SMS短信提醒
        /// </summary>		
        [Display(Name = "是否SMS短信提醒")]
        public bool IsSMS { get; set; }
        /// <summary>
        /// 是否邮件提醒
        /// </summary>		
        [Display(Name = "是否邮件提醒")]
        public bool? IsEmail { get; set; }
        /// <summary>
        /// 状态
        /// </summary>		
        [Display(Name = "状态")]
        public byte? Status { get; set; }

    }
}